package com.youdianstar.app.common.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * File: NetworkUtil
 * Author: 82149 Create: 2021/11/29 17:15
 * Changes (from 2021/11/29)
 * --------------------------------------------------
 * description:
 * ---------------------------------------------------
 */
public class NetworkUtil {
    /**
     * check NetworkAvailable
     *
     * @param context
     * @return
     */
    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager manager = (ConnectivityManager) context.getApplicationContext().getSystemService(
                Context.CONNECTIVITY_SERVICE);
        if (null == manager) {
            return false;
        }
        NetworkInfo info = manager.getActiveNetworkInfo();
        return null != info && info.isAvailable();
    }
}
